﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DBBase;

namespace Business
{
    public partial class ErroLog : Form
    {
        public ErroLog()
        {
            InitializeComponent();
        }
        public MainForm m_mainform;
        private void but_query_Click(object sender, EventArgs e)
        {
            getjilu();
        }
        public void getjilu()
        {
            list.Rows.Clear();
            Query mquery = new Query();
            string sql;
            sql = string.Format(@"Select * from ErrorLog where Log_Date>'{0}' and Log_Date<'{1}' order by Log_Date desc", dateTimePicker1.Value.ToShortDateString() + " 00:00:00", dateTimePicker2.Value.ToShortDateString() + " 23:59:59");
            DataTable dt = mquery.GetTable(sql);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                   
                    list.Rows.Add();
                    list.Rows[i].Cells[0].Value = string.Format("{0}", i + 1);
                    list.Rows[i].Cells[1].Value = dt.Rows[i]["Log_Type"].ToString().Trim();
                    list.Rows[i].Cells[2].Value = dt.Rows[i]["Log_Content"].ToString().Trim();
                    list.Rows[i].Cells[3].Value = dt.Rows[i]["Log_Date"].ToString().Trim();
                   
                }
            }
            else
            {
                MessageBox.Show("没有记录集");
            }

        }
      
      
    }
}
